<?php

namespace Api\Model;


class ExamModel extends BaseModel{

	public function getMid($cid, $difficulty, $znzj){
		if (!$cid) {
            return ['status' => 0, 'data' => '参数为空'];
        }
        $mid_items = $this->where(['cid' => $cid, 'difficulty' => $difficulty, 'znzj' => $znzj])->field('mid')->select();
        return $mid_items;
	}

	public function getByMid($mids){
		if (count($mids) == 0) {
            return ['success' => FALSE, '参数错误'];
        }

        // todo 考虑添加缓存机制 ，但是这张表又读又写 不好分离
        $mid_difficulty_items = $this->where(['mid' => ['IN', implode(',', $mids)]])->select();
        return $mid_difficulty_items;
	}
	
}